proc enable {nick host chan otbn1} {
  global botnick home bcast 

  if {$otbn1 == ""} {
    putquick "NOTICE $nick :\0034ERROR - Invalid Syntax - Should Be - (/msg) $botnick enable <username>"
    return 0
  }

  if {[onchan $otbn1 $chan]} {
    set hand2 [nick2hand $otbn1 $chan]
  } else {
    set hand2 $otbn1
  }

  if {![validuser $hand2]} {
    putquick "NOTICE $nick :\0034ERROR - Could not find \002$otbn1\002 in user partition."
    return 0
  } elseif {![matchattr $hand2 D]} {
    putquick "NOTICE $nick :\0034ERROR - The user '\002$hand2\002' is not disabled."
    return 0
  }	   

  putlog "!$nick ($host)! enable $hand2"
  putquick "NOTICE $nick :\0033Sucessfully enabled user account '\0034\002$hand2\002\0033'"

  if {$bcast == "1"} {
    putquick "PRIVMSG $home :\002$nick\002 ($host) requested me to enable the user account \002$hand2\002"
  }

  set permissions [getuser $hand2 XTRA "DISABLED-PERMISSIONS"]
  chattr $hand2 -D
  chattr $hand2 +$permissions
  setuser $hand2 XTRA "DISABLED-PERMISSIONS" ""
  save
  return 0
}

